#EMBED(%InLineUpdateLocalDataDeclarations,'In-Line Update Local Data Declarations'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
CASE UpdateAction #<!Process Setup for Update Actions
#IF(%InLineInsertAllowed)
OF TCACTION:InsertRecord #<!On Insert New Record
#EMBED(%OnInLineInsertBeforePriming,'In-Line Update On Insert Before Record Is Primed'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
#IF(%AutoIncField)
DO InsertRecord #<! Insert New Record
#ENDIF
SAVE:%FilePrefix:RECORD = %FilePrefix:RECORD #<! Save the Current Record
#FOR(%Field),WHERE(%FieldType = 'MEMO')
SAVE:%Field = %Field #<! Save the Memo Field
#ENDFOR
#FOR(%InLineInstance)
#IF(%InLineInitialValue)
%InLineField = %InLineInitialValue #<! Prime Field
#ENDIF
#ENDFOR
#EMBED(%OnInLineInsertAfterPriming,'In-Line Update On Insert After Record Is Primed'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
#ENDIF
#IF(%InLineChangeAllowed)
#IF(%InLineInsertAllowed)
#<!
#ENDIF
OF TCACTION:ChangeRecord #<!On Change Record
SAVE:%FilePrefix:RECORD = %FilePrefix:RECORD #<! Save the Current Record
#FOR(%Field),WHERE(%FieldType = 'MEMO')
SAVE:%Field = %Field #<! Save the Memo Field
#ENDFOR
#ENDIF
#IF(%InLineDeleteAllowed)
#IF(%InLineInsertAllowed OR %InLineChangeAllowed)
#<!
#ENDIF
OF TCACTION:DeleteRecord #<!On Delete Record
DO DeleteRecord #<! Delete the Record
GlobalResponse = LocalResponse #<! Set Global Response
RETURN #<! Exit Update Procedure
#ENDIF
END #<!End Case
#<!
ListControl{PROP:NoBar} = 1 #<!Turn Off Point Bar
#IF(%InLineUseAbortButton)
#CASE(%AbortButtonStatus)
#OF('HIDE')
UNHIDE(AbortButton) #<!Unhide Cancel Button
#OF('DISABLE')
ENABLE(AbortButton) #<!Enable Cancel Button
#OF('BOTH')
ENABLE(AbortButton) #<!Enable Cancel Button
UNHIDE(AbortButton) #<!Unhide Cancel Button
#ENDCASE
#IF(%InLineAbortButtonText)
#IF(SUB(LEFT(%InLineAbortButtonText),1,1)='!')
AbortButton{PROP:Text} = %InLineAbortButtonText #<!Set New Text for Cancel Button
#ELSE
AbortButton{PROP:Text} = '%InLineAbortButtonText' #<!Set New Text for Save Button
#ENDIF
#ENDIF
#ENDIF
#IF(%InLineUseSaveButton)
#CASE(%SaveButtonStatus)
#OF('HIDE')
UNHIDE(SaveButton) #<!Unhide Cancel Button
#OF('DISABLE')
ENABLE(SaveButton) #<!Enable Cancel Button
#OF('BOTH')
ENABLE(SaveButton) #<!Enable Cancel Button
UNHIDE(SaveButton) #<!Unhide Cancel Button
#ENDCASE
#IF(%InLineSaveButtonText)
#IF(SUB(LEFT(%InLineSaveButtonText),1,1)='!')
SaveButton{PROP:Text} = %InLineSaveButtonText #<!Set New Text for Save Button
#ELSE
SaveButton{PROP:Text} = '%InLineSaveButtonText' #<!Set New Text for Save Button
#ENDIF
#ENDIF
#ENDIF
#<!
LOOP #<!Process InLine Actions
#IF(%InLineUseColumnEdit)
IF UpdateAction = TCACTION:ChangeRecord #<!If Editing an Existing Record
TC:INL:UpdateMode = 1 #<! Use Column Edit Option
END #<!End If
#ENDIF
#FOR(%InLineFieldEquates)
TC:INL:FirstField = ?%InLineFieldEquates #<!Set First Field Number
#IF(SUB(LEFT(%InLinePropFrom),1,1) <> '''' AND INSTRING('|',%InLinePropFrom))
?%InLineField{PROP:From} = '%InLinePropFrom'
#ELSE
?%InLineField{PROP:From} = %InLinePropFrom
#ENDIF
?%InLineField{PROP:Format} = '%InLinePropFormat'
#IF(%InLinePropVScroll)
?%InLineField{PROP:VScroll} = 1
#ENDIF
#IF(%InLinePropHScroll)
?%InLineField{PROP:HScroll} = 1
#ENDIF
#ENDIF
#ENDFOR
#ENDFOR
#SUSPEND
#?OF TCACTION:SetHotKeys #<!Set Hot Keys Action
#IF(%InLineAbortKey)
TC:INL:AbortKey = %InLineAbortKey #<! Set Cancel Key
#ENDIF
#IF(%InLineUseAbortButton)
TC:INL:AbortButton = AbortButton #<! Set Cancel Button
#ENDIF
#IF(%InLineSaveKey)
TC:INL:SaveKey = %InLineSaveKey #<! Set Save Key
#ENDIF
#IF(%InLineUseSaveButton)
TC:INL:SaveButton = SaveButton #<! Set Save Button
#ENDIF
#IF(%InLineUseColumnEdit)
#IF(%InLineEditNextKey1)
TC:INL:EditNextKey1 = %InLineEditNextKey1 #<! Set Next Rec Key for Column Edit
#ENDIF
#IF(%InLineEditNextKey2)
TC:INL:EditNextKey2 = %InLineEditNextKey2 #<! Set Alt Next Rec Key for Column Edit
#ENDIF
#IF(%InLineEditPrevKey1)
TC:INL:EditPrevKey1 = %InLineEditPrevKey1 #<! Set Previous Rec Key for Column Edit
#ENDIF
#IF(%InLineEditPrevKey2)
TC:INL:EditPrevKey2 = %InLineEditPrevKey2 #<! Set Alt Previous Rec Key for Column Edit
#ENDIF
#ENDIF
#?
#RESUME
#SUSPEND
#?OF TCACTION:FieldEdits #<!Process Field Edits Action
#?CASE TC:INL:Field
#EMBED(%InLineFieldEdits,'In-Line Update Field Validations'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
#?END
#?
#RESUME
#?OF TCACTION:UpdateRecord #<!Update Record Action
#IF(%MemoCount)
IF SAVE:%FilePrefix:RECORD = %FilePrefix:RECORD AND| #<!If the Record was Not Changed and
#CLEAR(%ValueConstruct)
#FOR(%Field),WHERE(%FieldType = 'MEMO')
#SET(%ValueConstruct,%ValueConstruct+1)
#IF(%ValueConstruct = %MemoCount)
SAVE:%Field = %Field #<! the memo was not Changed
#ELSE
SAVE:%Field = %Field AND| #<! the memo was not Changed and
#ENDIF
#ENDFOR
#ELSE
IF SAVE:%FilePrefix:RECORD = %FilePrefix:RECORD #<!If the Record was Not Changed
#ENDIF
LocalResponse = RequestCompleted #<! Set Local Response to Completed
CYCLE #<! Nothing to Save - Exit In-Line
END #<!End If
#EMBED(%BeforeInlineFileAction,'In-Line Update On Completion Before Writing To Disk'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
LOOP #<!Attempt to Update Until Done or Canceled
Error%# = DUPLICATE(%File) #<! Test For Duplicate Key
IF Error%# #<! If Duplicate Key Error
Button%# = MESSAGE('Updating this record creates a duplicate entry!', |
IF UpdateAction = TCACTION:InsertRecord #<! If Inserting a New Record
ADD(%File) #<! Add the Record
Error%# = ERRORCODE() #<! Set Error Flag
ELSE #<! Otherwise on Updating a Record
Error%# = RIUpdate:%File() #<! Attempt Update
END #<! End If
#ENDIF
END #<! End If
IF Error%# #<! If Error Updating
SETCURSOR() #<! Reset to Normal Cursor
Button%# = StandardWarning(Warn:UpdateError) #<! Ask If User Wants to Try Saving Again
DISPLAY #<! Refresh Screen
CASE Button%# #<! Process User Response
OF Button:Yes #<! On YES Button
CYCLE #<! Retry Update Operation
OF Button:No #<! On NO Button
BREAK #<! Exit without Updating Record
OF Button:Cancel #<! On Cancel Button
TC:INL:AbortUpdate = True #<! Tell Inline to Cancel Update Request
BREAK #<! Go back to editing record
END #<! End Case
END #<! End If
SETCURSOR() #<! Reset to Normal Cursor
LocalResponse = RequestCompleted #<! Set Local Response to Completed
BREAK #<! Exit Update Loop
END #<!End Loop
#EMBED(%AfterInlineFileAction,'In-Line Update On Completion After Writing To Disk'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription)
#<!
OF TCACTION:AbortUpdate #<!Abort Update Action
IF TC:INL:ResizeWindow THEN CYCLE. #<!Always abort changes on resize
#IF(%MemoCount)
IF SAVE:%FilePrefix:RECORD <> %FilePrefix:RECORD OR| #<!If the Record was Changed or
#CLEAR(%ValueConstruct)
#FOR(%Field),WHERE(%FieldType = 'MEMO')
#SET(%ValueConstruct,%ValueConstruct+1)
#IF(%ValueConstruct = %MemoCount)
SAVE:%Field <> %Field #<! the memo was Changed
#ELSE
SAVE:%Field <> %Field OR| #<! the memo was Changed or
#ENDIF
#ENDFOR
#ELSE
IF SAVE:%FilePrefix:RECORD <> %FilePrefix:RECORD #<!If the Record was Changed
#ENDIF
Button%# = StandardWarning(Warn:SaveOnCancel) #<! Display Save on Cancel Message
DISPLAY #<! Refresh Screen
CASE Button%# #<! Process User Response
OF Button:Yes #<! On YES Button
TC:INL:AbortUpdate = False #<! Cancel the Request to Abort
TC:INL:SelectField = ListControl #<! Select List to Exit & Save Changes
OF Button:No #<! On NO Button
TC:INL:AbortUpdate = True #<! Go Ahead and Abandon the Changes
OF BUTTON:Cancel #<! On Cancel Button
TC:INL:AbortUpdate = False #<! Cancel the Request and Continue
END #<! End Case
END #<!End If
IF UpdateAction = TCACTION:InsertRecord #<!If Adding a New Record
IF TC:INL:AbortUpdate = True #<! If Record Add was Aborted
DELETE(%File) #<! Delete the New Record from the File
END #<! End If
END #<!End If
#<!
OF TCACTION:ExitInLine #<!Exit InLine Action
BREAK #<!
END #<!End Case on Actions
END #<!End Loop
#<!
#SUSPEND
#?IF NOT TC:INL:UpdateAction #<!If Not Processing a Column Update Action
#IF(%InLineUseAbortButton)
#CASE(%AbortButtonStatus)
#OF('HIDE')
HIDE(AbortButton) #<! Hide Cancel Button
#OF('DISABLE')
DISABLE(AbortButton) #<! Disable Cancel Button
#OF('BOTH')
HIDE(AbortButton) #<! Hide Cancel Button
DISABLE(AbortButton) #<! Disable Cancel Button
#ENDCASE
#IF(%InLineAbortButtonText)
AbortButton{PROP:Text} = %AbortButtonOrigText #<! Restore Normal Text for Cancel Button
#ENDIF
#ENDIF
#IF(%InLineUseSaveButton)
#CASE(%SaveButtonStatus)
#OF('HIDE')
HIDE(SaveButton) #<! Hide Cancel Button
#OF('DISABLE')
DISABLE(SaveButton) #<! Disable Cancel Button
#OF('BOTH')
HIDE(SaveButton) #<! Hide Cancel Button
DISABLE(SaveButton) #<! Disable Cancel Button
#ENDCASE
#IF(%InLineSaveButtonText)
SaveButton{PROP:Text} = %SaveButtonOrigText #<! Restore Normal Text for Save Button
#ENDIF
#ENDIF
#IF(INSTRING('NOBAR',%WindowStatement,1,1))
ListControl{PROP:NoBar} = 1 #<! Restore Hide Selection on Point Bar
#ENDIF
#?END #<!End If
#RESUME
GlobalResponse = LocalResponse #<!Set Global Response
LocalResponse = RequestCancelled #<!Default to Request to Delete Cancelled
#<!
#EMBED(%OnInLineDeleteBeforeDelete,'In-Line Update On Delete Before Record Is Deleted'),%ActiveTemplateInstance,MAP(%ActiveTemplateInstance,%ActiveTemplateinstanceDescription),WHERE(%ActiveTemplate = 'BrowseBox(ToolCraft)')
#IF(%InLineActionOnDelete='Standard Warning')
#IF(INSTRING('NOBAR',%WindowStatement,1,1))
ListControl{PROP:NoBar} = 0 #<!Turn On Point Bar
#ENDIF
Confirm%# = StandardWarning(Warn:StandardDelete) #<!Get Confirmation from User
#IF(INSTRING('NOBAR',%WindowStatement,1,1))
ListControl{PROP:NoBar} = 1 #<!Restore Hide Selection for Point Bar
#ENDIF
DISPLAY #<!Refresh Screen
IF Confirm%# <> Button:OK THEN EXIT. #<!If User Did Not Confirm Delete then Exit
#ENDIF
#<!
LOOP #<!Attempt to Delete Until Done or Canceled
SETCURSOR(Cursor:Wait) #<! Show Hour-Glass Cursor
IF RIDelete:%File() #<! If Error Deleting
SETCURSOR() #<! Reset to Normal Cursor
CASE StandardWarning(Warn:DeleteError) #<! Ask If User Wants to Try Deleting Again
OF Button:Yes #<! On YES Button
CYCLE #<! Retry Delete Operation
OF Button:No #<! On NO Button
OROF Button:Cancel #<! Or On Cancel Button
BREAK #<! Exit without Deleting Record
END #<! End Case
END #<! End If
SETCURSOR() #<! Reset to Normal Cursor
LocalResponse = RequestCompleted #<! Set Request Completed